import type { postOrPutType } from "@/constants";
import type { IResult } from "@/types/common";
import { getAxios, commonAxiosJson, deleteAxios } from "@/utils/request.ts";
const url = "/back/dict-config";
/*字典数据：获取字典数据所有信息 */
export const getDictDataInfo = <T, D>(params?: D): Promise<IResult<T>> => {
  return getAxios<T, D>(url, params);
};

/*字典数据：新增修改 */
export const commonDictDataInfo = <T, D>(params: D, type: postOrPutType): Promise<IResult<T>> => {
  return commonAxiosJson<T, D>(url, params, type);
};
/* 字典数据：修改字典标签 排序 信息 */
export const putDictLabelSortInfo = <T, D>(params: D): Promise<IResult<T>> => {
  return commonAxiosJson<T, D>(url + "/update-sort", params, "PUT");
};
/* 字典数据：删除字典标签信息 */
export const deleteDictLabelInfo = <T, D>(params: D): Promise<IResult<T>> => {
  return deleteAxios<T, D>(url, params);
};
